#include "stm32_delay.h"

void stm32_delay_10us(uint16_t time){
	uint32_t val = 16700000-time*720;
	uint32_t rVal = 0xFFFFFF;
	SysTick_Config(16700000);
	while(rVal>val){
		rVal = SysTick->VAL;
	}
	SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
}

void stm32_delay_ms(uint16_t time){
	uint32_t val = 16700000-time*72000;
	uint32_t rVal = 0xFFFFFF;
	SysTick_Config(16700000);
	while(rVal>val){
		rVal = SysTick->VAL;
	}
	SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
}
